Skip to content

Bump css_parser to 3.0.0 (CVE-2026-53727) - #4353

Open
akostadinov-bot[bot] wants to merge 3 commits into
masterfrom
THREESCALE-15563-bump-css-parser
Open

Bump css_parser to 3.0.0 (CVE-2026-53727)#4353
akostadinov-bot[bot] wants to merge 3 commits into
masterfrom
THREESCALE-15563-bump-css-parser

Conversation

@akostadinov-bot

@akostadinov-bot akostadinov-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bumps css_parser from 1.21.1 to 3.0.0 to address CVE-2026-53727 (SSRF + local file disclosure via @import following with base_uri:)
  • Bumps prawn-svg from 0.32.0 to 0.40.3 (required for css_parser 3.x compatibility)
  • Transitive deps bumped: prawn 2.4→2.5, pdf-core 0.9→0.10, ttfunk 1.7→1.8

Exploitability assessment

Not exploitable in porta — included as defense-in-depth:

  • The CVE requires attacker-controlled CSS and the base_uri: option to be set
  • porta's only usage (app/lib/pdf/report.rb) feeds server-generated SVG graph styles into css_parser — no user input
  • base_uri: is never passed anywhere in the codebase, so the @import-following code path that triggers SSRF is dead
  • No calls to load_uri! or read_remote_file exist in porta's code

Test plan

  • Verified css_parser 3.0.0 API is backwards-compatible with porta's usage pattern (load_string!, add_block!, each_selector)
  • Smoke-tested the exact report.rb code path (color substitution + hardcoded CSS blocks)
  • CI passes

THREESCALE-15563

🤖 Generated with Claude Code

css_parser < 3.0.0 is vulnerable to SSRF and local file disclosure via
@import following in attacker-controlled CSS with base_uri: set. While
porta's usage is not exploitable (no attacker-controlled CSS, no
base_uri: option), bumping to the patched version as defense-in-depth.

Also bumps prawn-svg 0.32.0 -> 0.40.3 (required for css_parser >= 2.0
compatibility), along with transitive deps prawn 2.4.0 -> 2.5.0,
pdf-core 0.9.0 -> 0.10.0, ttfunk 1.7.0 -> 1.8.0.

THREESCALE-15563

Assisted-By: claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread Gemfile.lock
acts_as_tree (2.9.1)
activerecord (>= 3.0.0)
addressable (2.8.8)
addressable (2.9.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlledom there was something with addressable but I forgot what it was 🤔

@qltysh

qltysh Bot commented Jul 22, 2026

Copy link
Copy Markdown

❌ 2 blocking issues (2 total)

Tool Category Rule Count
rubocop Lint Assignment Branch Condition size for traffic\_graph\_style is too high. [<5, 21, 1> 21.61/20] 1
reek Lint Pdf::Report#traffic_graph_style has the variable name 'a' 1

Comment thread app/lib/pdf/report.rb

def traffic_graph_style(svg)
xml = Nokogiri::XML(svg)
xml.css('a').each { |a| a.replace(a.children) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pdf::Report#traffic_graph_style has the variable name 'a' [reek:UncommunicativeVariableName]

Comment thread app/lib/pdf/report.rb

def traffic_graph_style(svg)
xml = Nokogiri::XML(svg)
xml.css('a').each { |a| a.replace(a.children) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

svg-graph wraps data points in elements (empty
URL) when show_data_points is true. prawn-svg 0.32 treated as a plain
container and ignored the href. prawn-svg 0.40 added a new Anchor element
class that creates PDF link annotations from them — even with an empty URL,
PDF viewers render a hover box.

@akostadinov

Copy link
Copy Markdown
Contributor

Attaching generated test PDFs for comparison.
old-invoice-multipage.pdf
old-report-day.pdf
old-report-multipage.pdf
old-report-week.pdf
fixed-invoice-multipage.pdf
fixed-report-day.pdf
fixed-report-multipage.pdf
fixed-report-week.pdf

@jlledom jlledom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me. The licenses job is failing, though.

:versions: []
:when: 2026-04-29 07:57:00.547859043 Z
- - :permit
- GPL-2.0-only

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akostadinov
akostadinov force-pushed the THREESCALE-15563-bump-css-parser branch from a2b8beb to 7a68e6a Compare July 24, 2026 18:24
prawn-svg 0.40+ converts <a xlink:href=""> elements into PDF link
annotations. svg-graph generates these with empty URLs around data
points when show_data_points is true, causing useless black hover
boxes in PDF viewers. Strip them in traffic_graph_style which already
does Nokogiri SVG manipulation.

THREESCALE-15563

Assisted-By: claude-opus-4-6
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@akostadinov
akostadinov force-pushed the THREESCALE-15563-bump-css-parser branch from 7a68e6a to 96fd318 Compare July 24, 2026 18:30
@akostadinov
akostadinov requested a review from jlledom July 24, 2026 18:45
Prawn/pdf-core/ttfunk migrated license metadata from deprecated SPDX-style identifiers (GPL-2.0, GPL-3.0) to modern SPDX identifiers (GPL-2.0-only, GPL-3.0-only). LICENSE file has not changed. Existing policy already permits GPL-2.0 and GPL-2.0+, so adding GPL-2.0-only aligns scanner metadata with existing approval policy.
@akostadinov
akostadinov force-pushed the THREESCALE-15563-bump-css-parser branch from 96fd318 to 4e90f3e Compare July 24, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants